689dd9ce6bf5a4659325aeb7d9c265468202822f,opennms-dao/src/test/java/org/opennms/netmgt/dao/support/FindTopLevelResourcesTest.java,FindTopLevelResourcesTest,execute_testFindTopLevelResources_provisionedNodes,#boolean#,190

Before Change


        setStoreByForeignSource(storeByForeignSource);
        List<OnmsNode> nodes = new ArrayList<OnmsNode>();

        OnmsNode n1 = new OnmsNode();
        n1.setId(1);
        n1.setLabel("node1");
        n1.setForeignSource("Junit");
        n1.setForeignId("node1");
        OnmsIpInterface ip1 = new OnmsIpInterface();
        ip1.setId(11);
        ip1.setIpAddress(InetAddressUtils.addr("10.0.0.1"));
        ip1.setNode(n1);
        n1.addIpInterface(ip1);
        nodes.add(n1);

        expect(m_dataCollectionConfigDao.getLastUpdate()).andReturn(new Date(System.currentTimeMillis())).times(2);
        expect(m_dataCollectionConfigDao.getConfiguredResourceTypes()).andReturn(new HashMap<String, ResourceType>());
        expect(m_nodeDao.get(n1.getId())).andReturn(n1).times(2); // TODO ResponseTimeResourceType is the responsible for this.
        expect(m_nodeDao.findAll()).andReturn(nodes);
        if (storeByForeignSource) {
            expect(m_nodeDao.findByForeignId(n1.getForeignSource(), n1.getForeignId())).andReturn(n1).times(1);            
        } else {
            expect(m_locationMonitorDao.findStatusChangesForNodeForUniqueMonitorAndInterface(n1.getId())).andReturn(new ArrayList<LocationMonitorIpInterface>(0));
        }

        File snmpDir = m_fileAnticipator.tempDir("snmp");
        if (storeByForeignSource) {
            File fsDir = m_fileAnticipator.tempDir(snmpDir, "fs");
            File node1fsDir = m_fileAnticipator.tempDir(fsDir, n1.getForeignSource());
            File node1Dir = m_fileAnticipator.tempDir(node1fsDir, n1.getForeignId());
            m_fileAnticipator.tempFile(node1Dir, "foo" + RrdUtils.getExtension());
        } else {
            File nodeDir = m_fileAnticipator.tempDir(snmpDir, n1.getId().toString());
            m_fileAnticipator.tempFile(nodeDir, "foo" + RrdUtils.getExtension());
        }

        File responseDir = m_fileAnticipator.tempDir("response");

After Change


        } else {
            nodeDir = m_fileAnticipator.tempDir(snmpDir, n1.getId().toString());
        }
        m_fileAnticipator.tempFile(nodeDir, "foo" + RrdUtils.getExtension());

        // RRD Directory for an orphan node
        File orphanDir = null;
        if (storeByForeignSource) {
            orphanDir = m_fileAnticipator.tempDir(fsDir, "orphan_node");
        } else {
            orphanDir = m_fileAnticipator.tempDir(snmpDir, "100");
        }
        m_fileAnticipator.tempFile(orphanDir, "foo" + RrdUtils.getExtension());

        // Response Time RRD Directory for n1
        File responseDir = m_fileAnticipator.tempDir("response");